// 引入二次封装的axios实例
import request from '@/utils/request'

// 获取一级分类的列表数据
export const reqCatogory1List = () => request({
  url: '/admin/product/getCategory1',
  method: 'GET'
})

// 获取二级分类的列表数据
export const reqCatogory2List = (category1Id) => request({
  url: `/admin/product/getCategory2/${category1Id}`,
  method: 'GET'
})

// 获取三级分类的列表数据
export const reqCatogory3List = (category2Id) => request({
  url: `/admin/product/getCategory3/${category2Id}`,
  method: 'GET'
})

// 获取商品基础属性
export const reqAttrInfoList = (category1Id, category2Id, category3Id) => request({
  url: `/admin/product/attrInfoList/${category1Id}/${category2Id}/${category3Id}`,
  method: 'GET'
})

// 添加/更新商品属性、属性值
export const reqAddOrUpdateAttrInfo = (attrInfo) => request({
  url: '/admin/product/saveAttrInfo',
  method: 'POST',
  data: attrInfo
})

// 删除商品属性
export const reqDeleteAttr = (attrId) => request({
  url: `/admin/product/deleteAttr/${attrId}`,
  method: 'DELETE'
})
